package com.example.pceb.common;

import java.util.HashMap;

//通用类
public class R extends HashMap<String,Object> {
    public R() {
        put("code", 200);
        put("message", "success");
    }

    public static R ok() {
        return new R();
    }

    public static R ok(Object data) {
        R r = new R();
        r.put("data", data);
        return r;
    }

    public static R error(String msg) {
        R r = new R();
        r.put("code", 500);
        r.put("message", msg);
        return r;
    }

    public R put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
